import request from '@/utils/request'

/**
 * 查询企业的部门列表
 *  /company/department  GET
 * **/
export function getDepartments() {
  return request({
    url: `/company/department`
  })
}

/**
 * 根据ID删除部门
 *   /company/department/{id}  DELETE
 * **/
export function delDepartments(id) {
  return request({
    url: `/company/department/` + id,
    method: 'delete'
  })
}

/**
 * 新增部门
 *    /company/department  post
 * **/
export function addDepartment(data) {
  return request({
    url: `/company/department`,
    method: 'post',
    // 表单作为请求体发送
    data
  })
}

/**
 * 根据ID查询部门详情
 *    /company/department/{id}  GET
 * **/
export function getDepartmentDetail(id) {
  return request({
    url: `/company/department/${id}`
  })
}

/**
 * 根据ID修改部门详情
 *     /company/department/{id}  PUT
 * **/
export function editDepartment(data) {
  return request({
    url: `/company/department/${data.id}`,
    method: 'put',
    data
  })
}
